{% extends "data_edit.html" %} {% load i18n %} {% block form %} {% autoescape off %} {{form.city_name|field_as_td_h}} {{form.city_code|field_as_td_h}} {% for i,k in form.errors.items %} {{i}}{{k}} {% endfor %}
{{ form.country|field_as_label_tag }} {{form.country.as_widget }} {{form.country.errors }}
{{ form.state|field_as_label_tag }} {{form.state.as_widget }} {{form.state.errors }}
{{form.city_name.errors }}
{{form.city_code.errors }}
{% endautoescape %} {% endblock %} {% block addjs %} $("label[for='id_code']").attr("class","required"); $('#id_country').change( function() { var url="/{{ request.surl }}personnel/select_state/personnel/State/?country="; var v=$(this).val(); if (v=="") return; url+=v; $.ajax({ type: "POST", url:encodeURI(url), dataType: "json", success: function(msg){ var html_list = []; html_list.push( ""); if(msg.length != 0){ for(var i =0;i"+msg[i][1] + " "+msg[i][2]+""; html_list.push(row); } } $("#id_state").html(html_list.join("")); } }); }); $(function(){ if($("#id_edit_form").find("#id_city_code").val()!=""){ $("#yanzheng").hide(); }else{ $("#yanzheng").show(); } }); {% endblock %}